///
/// This method is called when a page is loaded.
///
/// The object that raised the load event.
/// The object that contains the event data of the load event.
private void MyPageLoad(object sender, System.EventArgs e)
{
try
{
if (!this.IsPostBack)
{
System.Web.UI.WebControls.DataGrid DataGrid;
// "myDataGrid" is the id of the ASP DataGrid
DataGrid = ((System.Web.UI.WebControls.DataGrid)(this.FindControlRecursively("myDataGrid")));
if (DataGrid!= null)
{
// example of wherestr is
// whereStr = " myNumericField = 1";
// whereStr = " myStrField = '1'";
string whereStr = null;
// Create orderBy clause
BaseClasses.Data.OrderBy oB = null;
// Set page index and size
int pageIndex = 0;
int pageSize = 1000;
// Retrieving first 1000 records.
DataGrid.DataSource = ${${Table Name}ClassName}.GetDataTable(whereStr, oB, pageIndex, pageSize);
DataGrid.DataBind();
}
}
}
catch (Exception ex)
{
// Report error message to the user
BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "UNIQUE_SCRIPTKEY", ex.Message);
}
}
|